home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-02-06 | 13.1 KB | 407 lines | [TEXT/CWIE] |
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** Functions to help you when you are building and sending Apple events.
- **
- ** by Andy Bachorski, Apple Developer Technical Support
- **
- ** File: MoreFinderEvents.h
- **
- ** Version: 0.3.5
- **
- ** Copyright © 1996 Apple Computer, Inc.
- ** All rights reserved.
- **
- ** You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes.
- */
-
- //
- // %%%%% need to change calls to object building function to pass a boolean
- // %%%%% parameter to control the disposal of descs passed in.
-
- #ifndef AEHELPERS
- #define AEHELPERS
-
-
- // Prefix file
- #include "Prefix.h"
-
- // System includes
- #include <AERegistry.h>
- #include <AEObjects.h>
- #include <AEPackObject.h>
- #include <Aliases.h>
- #include <Icons.h>
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
-
- // *****************************************************************************
-
- PASCAL OSErr FindProcessBySignature( const OSType targetType,
- const OSType targetCreator,
- ProcessSerialNumberPtr psnPtr );
-
- /* The FindProcessBySignature function returns a ProcessSerialNumber
- for a process whose signature (type and creator) matches the input values.
- The ProcessSerialNumber will be kNoProcess is the requested process cannot
- be found.
-
- targetType input: The file type of the process to be found.
- targetCreator input: The creator type of the process to be found.
-
- psnPtr input: Pointer to a ProcessSerialNumber where the
- process serial number is returned.
- output: Process serial number.
-
- RESULT CODES
- ____________
- noErr 0 No error
- procNotFound –600 No eligible process with specified descriptor
- ____________
- */
-
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeAppleEventSignatureTarget( const OSType targetType,
- const OSType targetCreator,
- const AEEventClass eventClass,
- const AEEventID eventID,
- AppleEvent *theEvent );
-
- /* Create and return an AppleEvent of the given class and ID. The event will be
- targeted at the process specified by the target type and creator codes,
- with an AEAddressDesc of type typeProcessSerialNumber.
-
- targetType input: The file type of the process to be found.
- targetCreator input: The creator type of the process to be found.
- eventClass input: The class of the event to be created.
- eventID input: The ID of the event to be created.
-
- theEvent input: Pointer to an AppleEvent record where the
- event record will be returned.
- output: The Apple event.
-
- RESULT CODES
- ____________
- noErr 0 No error
- memFullErr -108 Not enough room in heap zone
- procNotFound –600 No eligible process with specified descriptor
- ____________
- */
-
-
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeEventProcessTarget( const ProcessSerialNumberPtr psnPtr,
- const AEEventClass eventClass,
- const AEEventID eventID,
- AppleEvent *theEvent );
-
- /* Create and return an AppleEvent of the given class and ID. The event will be
- targeted with the provided PSN.
-
- psnPtr input: Pointer to the PSN to target the event with.
- eventClass input: The class of the event to be created.
- eventID input: The ID of the event to be created.
-
- theEvent input: Pointer to an AppleEvent record where the
- event record will be returned.
- output: The Apple event.
-
- RESULT CODES
- ____________
- noErr 0 No error
- memFullErr -108 Not enough room in heap zone
- procNotFound –600 No eligible process with specified descriptor
- ____________
- */
-
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeEventTargetID( const TargetID *targetIDPtr,
- const AEEventClass eventClass,
- const AEEventID eventID,
- AppleEvent *theEvent );
-
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeAliasDescFromFSSpec( const FSSpecPtr fssPtr,
- AEDesc *aliasDesc );
-
- /* Create and return an AEDesc of type typeAlias using the provided FSSpec.
-
- fssPtr input: Pointer to the FSSpec to use.
-
- theEvent input: Pointer to null AEDesc.
- output: an AEDesc of type typeAlias.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr -50 The value of target or alias parameter, or of
- both, is NIL, or the alias record is corrupt
- memFullErr -108 Not enough room in heap zone
- ____________
- */
-
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeAliasDesc( const AliasHandle aliasHandle,
- AEDesc *aliasDesc );
-
- /* Create and return an AEDesc of type typeAlias using the provided
- alias record.
-
- fssPtr input: Handle to an alias record.
-
- theEvent input: Pointer to null AEDesc.
- output: an AEDesc of type typeAlias.
-
- RESULT CODES
- ____________
- noErr 0 No error
- memFullErr -108 Not enough room in heap zone
- ____________
- */
-
-
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeAliasObjectFromFSSpec( const FSSpecPtr fssPtr,
- AEDesc *containerObj,
- AEDesc *aliasObject );
- /*
- Given an FSSpec, return an object descriptor containing an alias,
- contained by a null object.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr -50 The value of target or alias parameter, or of
- both, is NIL, or the alias record is corrupt
- memFullErr -108 Not enough room in heap zone
- errAECoercionFail -1700 Data could not be coerced to the requested
- Apple event data type
- errAEWrongDataType -1703 Wrong Apple event data type
- errAENotAEDesc -1704 Not a valid descriptor record
- errAEBadListItem -1705 Operation involving a list item failed
- ____________
- */
-
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeAliasObject( const AliasHandle aliasHandle,
- AEDesc *containerObj,
- AEDesc *aliasObject );
- /*
- Given an object descriptor, create an new object descriptor containing an
- alias, contained by the input object descriptor.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr -50 Error in parameter list
- memFullErr -108 Not enough room in heap zone
- errAECoercionFail -1700 Data could not be coerced to the requested
- Apple event data type
- errAEWrongDataType -1703 Wrong Apple event data type
- errAENotAEDesc -1704 Not a valid descriptor record
- errAEBadListItem -1705 Operation involving a list item failed
- ____________
- */
-
- // *****************************************************************************
-
- PASCAL OSErr AEHMakePropertyObject( const DescType propType,
- AEDesc *containerObj,
- AEDesc *propertyObj );
- /*
- Given an object descriptor, create an new object descriptor containing
- an property, contained by the input object descriptor.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr -50 Error in parameter list
- memFullErr -108 Not enough room in heap zone
- errAECoercionFail -1700 Data could not be coerced to the requested
- Apple event data type
- errAEWrongDataType -1703 Wrong Apple event data type
- errAENotAEDesc -1704 Not a valid descriptor record
- errAEBadListItem -1705 Operation involving a list item failed
- ____________
- */
-
- // *****************************************************************************
- PASCAL OSErr AEHMakeProcessObject( const ProcessSerialNumber *psnPtr,
- AEDesc *containerObj,
- AEDesc *propertyObj );
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeSelectionObject( const DescType selection,
- AEDesc *containerObj,
- AEDesc *propertyObj );
- /*
- Given an object descriptor, create an new object descriptor containing
- a selection object using the selection specifier, contained by the
- input object descriptor.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr -50 Error in parameter list
- memFullErr -108 Not enough room in heap zone
- errAECoercionFail -1700 Data could not be coerced to the requested
- Apple event data type
- errAEWrongDataType -1703 Wrong Apple event data type
- errAENotAEDesc -1704 Not a valid descriptor record
- errAEBadListItem -1705 Operation involving a list item failed
- __________
- */
-
- // *****************************************************************************
- PASCAL OSErr AEHMakeIconSuite( const AEDescList *iconFamilyRecPtr,
- Handle *iconSuitePtr );
- // *****************************************************************************
-
- PASCAL OSErr AEHMakeIconFamilyRecord( const Handle iconSuite,
- const IconSelectorValue iconSelector,
- AEDescList *iconFamilyRecPtr );
-
- /* ¶ Make an icon family record containing the icons specified in the
- iconSelector parameter.
- The iconSuite parameter should contain an icon suite, as returned by a
- call to GetIconSuite.
-
- iconSuite input: The icon suite to build the record from.
- iconSelector input: Which icons to include in the record.
- iconFamilyRecPtr input: A null descriptor record.
- output: An AERecord that's been coerced to an
- icon family record.
-
- Result Codes
- ____________
- noErr 0 No error
- paramErr -50 The value of target or alias parameter, or of
- both, is NIL, or the alias record is corrupt
- memFullErr -108 Not enough room in heap zone
- errAECoercionFail -1700 Data could not be coerced to the requested
- Apple event data type
- ____________
-
- Also see:
- */
-
- // *****************************************************************************
-
- PASCAL OSErr AEHGetHandlerError( const AppleEvent *reply );
- /*
- Given a reply event, checks for errors returned by the event handler,
- and returns any that are found.
-
- reply input: The reply event to be checked.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr -50 The value of target or alias parameter, or of
- both, is NIL, or the alias record is corrupt
- memFullErr -108 Not enough room in heap zone
- errAECoercionFail -1700 Data could not be coerced to the requested
- Apple event data type
- errAEWrongDataType -1703 Wrong Apple event data type
- errAENotAEDesc -1704 Not a valid descriptor record
- errAEBadListItem -1705 Operation involving a list item failed
-
- ???? Pretty much any error, depending on what the handler
- of the event sent does.
- ____________
- */
-
- // *****************************************************************************
-
- PASCAL Boolean AEHSimpleIdleFunction( EventRecord *event,
- long *sleepTime,
- RgnHandle *mouseRgn );
- /*
- A very simple idle function. It simply ignors an event it receives,
- returns 30 for the sleep time and nil for the mouse region.
-
- Your application would normally supply a more robust idle function,
- especially if you have any window. See the tech note on Pending Update
- Perils.
- */
-
- // *****************************************************************************
-
- PASCAL Boolean HasAppleEvents( void );
- /*
- Calls Gestalt and checks if the Apple Event Manager is available.
-
- Use this routine together with FinderCallsAEProcess to determine which
- suite of events the Finder supports. If FinderCallsAEProcess returns false
- the Finder supports the subset of the older Finder event suite.
-
- RESULT CODES
- ____________
- true The Apple Event Manager is present
- false It isn't
- */
-
- // *****************************************************************************
-
- PASCAL Boolean FinderCallsAEProcess( void );
- /*
- Calls Gestalt and checks if the Finder calls AEProcessAppleEvent.
- If true, the Finder is version 7.1.3 or later.
-
- Use this routine together with FinderIsOSLCompliant to determine which
- suite of events the Finder supports. If FinderIsOSLCompliant returns false
- the Finder supports the full older Finder event suite.
-
- RESULT CODES
- ____________
- true The Finder calls supports the full old Finder event suite
- false It doesn't
- */
-
- // *****************************************************************************
-
- PASCAL Boolean FinderIsOSLCompliant( void );
- /*
- Calls Gestalt and checks if the Finder is OSL compliant, i.e., it supports
- the new Finder event suite.
-
- If true, the Finder is version 7.5 or later. This means the Finder supports,
- and that you should use, the new Finder event suite. It also means that
- support for the events present in old Finder event suite is either missing
- or incomplete.
-
- RESULT CODES
- ____________
- true The Finder supports the new Finder event suite, not the old
- false It doesn't
- */
-
- // *****************************************************************************
-
- #ifdef __cplusplus
- }
- #endif
-
- #ifndef COMPILING_MORE_FINDER_EVENTS
- #undef PASCAL
- #endif
-
- #endif// AEHELPERS
-